package org.ls.petclinic.dao.impl;

import org.ls.petclinic.dao.VetSpecialtiesDao;
import org.ls.petclinic.pojo.VetSpecialties;

import java.util.List;

/**
 * @author 浪矢先生
 * @description
 * @create 2022-12-05 21:52
 */
public class VetSpecialtiesDaoImpl extends BaseDao implements VetSpecialtiesDao {
    @Override
    public List<VetSpecialties> getAll() {
        return queryForList(VetSpecialties.class, "select * from vetspecialties");
    }

    @Override
    public List<VetSpecialties> getByVetId(Long vetId) {
        return queryForList(VetSpecialties.class, "select * from vetspecialties where vetId=?",vetId);
    }

    @Override
    public List<VetSpecialties> getBySpecialtyId(Long specialtyId) {
        return queryForList(VetSpecialties.class, "select * from vetspecialties where specialtyId=?",specialtyId);
    }

    @Override
    public int add(Long specialtyId, Long vetId) {

        return update("insert into vetspecialties (vetId,specialtyId) values(?,?)",vetId,specialtyId);
    }
}
